<%@ tag language="java" pageEncoding="UTF-8"
	trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>

<%@ attribute name="sourceId" required="true" type="java.lang.String"
	description="relationId"%>

<%@ attribute name="readonly" required="false" type="java.lang.Boolean"
	description="readonly"%>

<script type="text/javascript">
	function add() {

	}
	$(document).ready(function() {
		
	});
	
	function afterLoad()
	{
	  $("[id^='jqmeter_']").each(function(index,item){
	       var tid=$(this).attr("id");
	       var tv=$(this).attr("tv");
	       var barColor="#0066CC";
	       if(tv==100 || tv>100)
	         barColor="#bfd255";
	       $('#'+tid).jQMeter({
			goal : '100',
			raised : tv,
			orientation:'horizontal',
			animationSpeed:1000,
			counterSpeed:1000,
			width : '200px',
			height : '30px',
			barColor:barColor
		});
	  });
	  
	  $('#taskProcessCount').text( taskProcessGrid.jqGrid.getGridParam('records'));
	}
	
	function formatHandleProcess(v,o,row)
	{
		var id=row.id;
		var html="<div id='jqmeter_"+id+"' tv='"+v+"'></div>";
	    return html;
	}
</script>
<isperp:grid gridId="taskProcessGrid" cusEditUrl="task/taskProcess/edit"
	cusDeleteUrl="task/taskProcess/delete"
	url="task/taskProcess/listDetail?relationId=${sourceId }"
	cusDialogHeight="600" cusDialogWidth="800" cusFormatterActions="true"
	showSearchbar="false" pager="false" height="auto" showPager="false"
	showToolbar="${!readonly }" loadComplete="afterLoad()">

	<jsp:attribute name="toolbar">
	<isperp:button id="selectCiBtn" icon="icon-plus" text="添加"
			cssClass="nui-mainbtn" onclick="taskProcessGrid.create()"></isperp:button>
	 </jsp:attribute>
	<jsp:body>
	
	<isperp:column name="id" title="id" hidden="true"></isperp:column>
	<isperp:column name="name" title="任务项" width="100"></isperp:column>
	<isperp:column name="value" title="当前进度" width="130" isFormatterFun="true"
					formatter="return formatHandleProcess(cellvalue,options,rowObject);"></isperp:column>
	<isperp:column name="meno" title="备注" width="110"></isperp:column>
	<isperp:column name="creator_name" title="创建人" width="80"></isperp:column>
	<isperp:column name="modifier_name" title="最后修改人" width="80"></isperp:column>
	<isperp:column name="modify_date" title="修改日期" width="90"></isperp:column>
	
</jsp:body>
</isperp:grid>

<div id="jqmeter-container"></div>

